<?php $this->renderPartial('_tabs'); ?>
<div class="grid_16">
    <div class="admin-accounting form">
		<?php echo CHtml::beginForm(); ?>
		<div class="table-block">
            <table class="form-table">
                <tr>
                    <td>
                        <div class="form-table-block">
							<label>Default Payment Terms:</label>
							<?php
							echo CHtml::dropDownList('Invoice_terms_select', (in_array($agency->getSetting('InvoiceDefaultTerms'), Invoice::getStandardInvoiceTerms()) ? $agency->getSetting('InvoiceDefaultTerms') : "Other"), Invoice::getStandardInvoiceTerms(), array('prompt' => ''));
							?>
                        </div>
						<div id="default_term_span" class="form-table-block" style="<?php echo (in_array($agency->getSetting('InvoiceDefaultTerms'), array('Due upon receipt', 'Due on Completion', 'Due on Possession', 'Due on Signing of Tenancy Agreement')) ? 'display: none' : ''); ?>">
							<label>Enter new default term: </label>
							<input id="default_term_text" type="text" size="20" name ="AgencySetting[InvoiceDefaultTerms]" value="<?php echo $agency->getSetting('InvoiceDefaultTerms'); ?>">
						</div>
                    </td>
                </tr>
				<tr>
                    <td>
                        <div class="form-table-block">
							<label>Standard Message:</label>
							<?php
							$this->widget('common.lib.redactor.ImperaviRedactorWidget', array(
								'name' => 'AgencySetting[InvoiceStandardMessage]',
								'value' => $agency->getSetting('InvoiceStandardMessage'),
								'options' => array(
									'buttons' => array('bold', 'italic', 'underline', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'alignleft', 'aligncenter', 'alignright', 'justify')
								),
								'htmlOptions' => array(
									'cols' => '40'
								)
							));
							?>
                        </div>
						<div>
							<span><i>To appear near the bottom of each invoice</i></span>							
						</div>
                    </td>
                </tr>
				<tr>
                    <td>
                        <div class="form-table-block">
							<label>Invoice Footer:</label>
							<?php
							$this->widget('common.lib.redactor.ImperaviRedactorWidget', array(
								'name' => 'AgencySetting[InvoiceFooter]',
								'value' => $agency->getSetting('InvoiceFooter'),
								'options' => array(
									'buttons' => array('bold', 'italic', 'underline', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'alignleft', 'aligncenter', 'alignright', 'justify')
								),
								'htmlOptions' => array(
									'cols' => '40'
								)
							));
							?>
                        </div>
						<div>
							<span><i>To appear near the bottom of each invoice</i></span>							
						</div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div>
							<label>Other Settings:</label>
                        </div>
						<div>
							<?php echo CHtml::checkBox('AgencySetting[InvoiceVisibleToSP]', $agency->getSetting('InvoiceVisibleToSP'), array('uncheckValue' => 0)); ?>
							<?php echo CHtml::label('Show Salesperson\'s Copy by default', 'AgencySetting_InvoiceVisibleToSP'); ?>
						</div>
                    </td>
                </tr>
                <tr>
                    <td>
						<?php echo GxHtml::submitButton('Save', array('name' => 'submit', 'class' => 'no-margin')); ?>
                    </td>
                </tr>
            </table>
        </div>
		<?php echo CHtml::endForm(); ?>
    </div>
</div>